package com.aliyun.messagemgt.repository.task;

import com.aliyun.messagemgt.fouraplugin.FouraService;
import com.aliyun.messagemgt.domain.repository.task.BaseTask;
import org.quartz.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @Author jingchaoyue
 * @Date 2019-08-12 11:56
 */
@DisallowConcurrentExecution
@Component
public class FouraSynTask implements BaseTask {

    @Autowired
    private FouraService fouraService;
    /**
     * <p>
     * Called by the <code>{@link Scheduler}</code> when a <code>{@link Trigger}</code>
     * fires that is associated with the <code>Job</code>.
     * </p>
     *
     * <p>
     * The implementation may wish to set a
     * {@link JobExecutionContext#setResult(Object) result} object on the
     * {@link JobExecutionContext} before this method exits.  The result itself
     * is meaningless to Quartz, but may be informative to
     * <code>{@link JobListener}s</code> or
     * <code>{@link TriggerListener}s</code> that are watching the job's
     * execution.
     * </p>
     *
     * @param context
     * @throws JobExecutionException if there is an exception while executing the job.
     */
    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        fouraService.sync4AData();
    }

    /**
     * 获取任务名称
     *
     * @return java.lang.String
     * @date 2019-08-12 14:54
     */
    @Override
    public String getName() {
        return "FouraSynTask";
    }

    /**
     * 获取组
     *
     * @return java.lang.String
     * @date 2019-08-12 14:54
     */
    @Override
    public String getGroup() {
        return "FouraSynTask";
    }
}
